# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1ErrorReport do
  @moduledoc """
  An error report received for an app. There reports are produced by the Android platform code when a (potentially fatal) error condition is detected. Identical reports from many users will be deduplicated and coalesced into a single ErrorReport. **Required permissions**: to access this resource, the calling user needs the _View app information (read-only)_ permission for the app.

  ## Attributes

  *   `appVersion` (*type:* `GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1AppVersion.t`, *default:* `nil`) - The app version on which an event in this error report occurred on.
  *   `deviceModel` (*type:* `GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1DeviceModelSummary.t`, *default:* `nil`) - A device model on which an event in this error report occurred on.
  *   `eventTime` (*type:* `DateTime.t`, *default:* `nil`) - Start of the hour during which the latest event in this error report occurred.
  *   `issue` (*type:* `String.t`, *default:* `nil`) - The issue this report was associated with. **Please note:** this resource is currently in Alpha. There could be changes to the issue grouping that would result in similar but more recent error reports being assigned to a different issue.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The resource name of the report. Format: apps/{app}/{report}
  *   `osVersion` (*type:* `GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1OsVersion.t`, *default:* `nil`) - The OS version on which an event in this error report occurred on.
  *   `reportText` (*type:* `String.t`, *default:* `nil`) - Textual representation of the error report. These textual reports are produced by the platform. The reports are then sanitized and filtered to remove any potentially sensitive information. Although their format is fairly stable, they are not entirely meant for machine consumption and we cannot guarantee that there won't be subtle changes to the formatting that may break systems trying to parse information out of the reports.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Type of the error for which this report was generated.
  *   `vcsInformation` (*type:* `String.t`, *default:* `nil`) - Version control system information from BUNDLE-METADATA/version-control-info.textproto or META-INF/version-control-info.textproto of the app bundle or APK, respectively.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :appVersion =>
            GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1AppVersion.t()
            | nil,
          :deviceModel =>
            GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1DeviceModelSummary.t()
            | nil,
          :eventTime => DateTime.t() | nil,
          :issue => String.t() | nil,
          :name => String.t() | nil,
          :osVersion =>
            GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1OsVersion.t()
            | nil,
          :reportText => String.t() | nil,
          :type => String.t() | nil,
          :vcsInformation => String.t() | nil
        }

  field(:appVersion,
    as:
      GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1AppVersion
  )

  field(:deviceModel,
    as:
      GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1DeviceModelSummary
  )

  field(:eventTime, as: DateTime)
  field(:issue)
  field(:name)

  field(:osVersion,
    as:
      GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1OsVersion
  )

  field(:reportText)
  field(:type)
  field(:vcsInformation)
end

defimpl Poison.Decoder,
  for:
    GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1ErrorReport do
  def decode(value, options) do
    GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1ErrorReport.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for:
    GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1ErrorReport do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
